import Vue from 'vue'
import App from './App.vue'
import router from './router/index'
import ElementUI from 'element-ui';
import axios from "axios";
import 'element-ui/lib/theme-chalk/index.css';
import 'font-awesome/css/font-awesome.min.css';

Vue.config.productionTip = false
Vue.use(ElementUI);
Vue.prototype.axios = axios;
new Vue({
  render: h => h(App),
  router,
  beforeCreate() {
    Vue.prototype.$bus = this;
  }
}).$mount('#app')

//rem布局
!(function(win, doc) {
  function setFontSize() {
    let winWidth = window.innerWidth;
    doc.documentElement.style.fontSize = (winWidth / 1080) * 100 + 'px';
  }
  let evt = 'onorientationchange' in win ? 'orientationchange' : 'resize';
  let timer = null;
  win.addEventListener(evt, function() {
    clearTimeout(timer);
    timer = setTimeout(setFontSize, 300);
  }, false);
  win.addEventListener("pageshow", function(e) {
    if (e.persisted) {
      clearTimeout(timer);
      timer = setTimeout(setFontSize, 300);
    }
  }, false);
  //初始化
  setFontSize();
}(window, document));

